#!/usr/bin/env bash
# 启用 POSIX 模式并设置严格的错误处理机制
set -o posix errexit -o pipefail

mkdir -p /home/kubernetes/helm
cd /home/kubernetes/helm || exit

rm -rf tar -zxvf helm-*.tar.gz

OS="linux"
machine=$(uname -m)
# 判断架构信息并设置变量的值
if [ "$machine" = "aarch64" ]; then
    ARCH="arm64"
elif [ "$machine" = "x86_64" ]; then
    ARCH="amd64"
else
    echo "请手动定义你的发行版的架构"
fi

wget https://get.helm.sh/helm-v3.17.0-rc.1-${OS}-${ARCH}.tar.gz

tar -zxvf helm-*.tar.gz
mv ${OS}-${ARCH}/helm /usr/local/bin

helm version

rm -rf tar -zxvf helm-*.tar.gz
